//app.js是项目的入口文件

const Koa = require("koa2");//构造函数
const app = new Koa();//生命实力
const port = 3000;

app.use(async (ctx,next) => {//调用中间件
  console.log(1)
  await next()
  console.log(1)
});
app.use(async (ctx,next) => {//调用中间件
  console.log(2)
  await next()
  console.log(2)
});
app.use(async (ctx) => {//调用中间件
  console.log(3)
});
app.listen(port, () => {
  console.log(`Serve is running athttp://localhost:${port}`)
})//监听3000端口3000